function Q_new = Q_ini_fun( Q_ini, param, aux)

    ln_m_ini = ln_m_KFE([param.m_l_ini, param.m_u_ini],1,aux)+log(1-param.shock);
    ln_m_new = ln_m_KFE([param.m_l, param.m_u],1,aux);

    Q_new_2 = nan(size(ln_m_ini));
    if  ln_m_ini(1)<log(param.m_l)
        ind = find(ln_m_ini>log(param.m_l),1);
        q = Q_ini(2:end)-Q_ini(1:end-1);
        layoff = q(1:ind)'./(1-param.alpha)*(log(param.m_l)-ln_m_ini(1:ind));
        Q_new_2(1:ind-1) = Q_ini(1)+layoff.*1/param.s;
        Q_new_2(ind:end) = Q_ini(ind:end) + layoff.*(1/param.s-1);
        
        Q_new = interp1( ln_m_ini(ind:end), Q_new_2(ind:end), ln_m_new,'linear','extrap');
        Q_new(1) = Q_new_2(1);
        if ln_m_new(end)>ln_m_ini(end)
            ind=find(ln_m_new>ln_m_ini(end),1);
            Q_new(ind:end) = Q_new_2(end);
        end
        Q_new(end) = Q_new_2(end);
        
    else
        Q_new = interp1( ln_m_ini, Q_ini, ln_m_new,'linear','extrap');
        if ln_m_new>ln_m_ini(end)
            ind = find(ln_m_new>ln_m_ini(end),1);
            Q_new(ind:end) = Q_ini(end);
        end
        ind = find(ln_m_ini(1)<ln_m_new,1);
        Q_new(1:ind) = Q_ini(1);
        Q_new(end) = Q_ini(end);        
    end    
end